//
//  OpenGlVieww.m
//  AudioPlayer
//
//  Created by leo on 2020/5/19.
//  Copyright © 2020 xiaokai.zhan. All rights reserved.
//

#import "OpenGlVieww.h"
#import <OpenGLES/ES2/glext.h>
#import <OpenGLES/ES2/gl.h>
@implementation OpenGlVieww

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
+ (Class)layerClass
{
    return [CAEAGLLayer class];
}
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        CAEAGLLayer * layer =(CAEAGLLayer *) [self layer];
        NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
                        [NSNumber numberWithBool:NO],
                        kEAGLDrawablePropertyRetainedBacking,
                        kEAGLColorFormatRGB565,
                        kEAGLDrawablePropertyColorFormat,
                        nil];
                 [layer setOpaque:YES];
                 [layer setDrawableProperties:dict];

       
    }
    return self;
}
-(void)openUpThread
{
    /* 创建一个并发队列 */
    dispatch_queue_t concurrent_queue = dispatch_queue_create("demo.gcd.concurrent_queue", DISPATCH_QUEUE_CONCURRENT);
    dispatch_async(concurrent_queue, ^{
        EAGLContext* _context;
        _context = [[EAGLContext alloc]initWithAPI:kEAGLRenderingAPIOpenGLES2];
        [EAGLContext setCurrentContext:_context];
        
        glGenFramebuffers(1,nil);
        glGenRenderbuffers(1, nil);
        glb

    });
    
}
@end
